package cn.shadowsouls.system.bean.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @TableName user_vote
 */
@TableName(value = "user_vote")
@Data
@NoArgsConstructor
public class UserLinkVote implements Serializable {
    /**
     *
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     *
     */
    @TableField(value = "uid")
    private Integer uid;

    /**
     *
     */
    @TableField(value = "vid")
    private Integer vid;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public UserLinkVote(Integer uid, Integer vid) {
        this.uid = uid;
        this.vid = vid;
    }

    public UserLinkVote(String userId, String voteId) {
        this.uid = Integer.valueOf(userId);
        this.vid = Integer.valueOf(voteId);

    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserLinkVote other = (UserLinkVote) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
                && (this.getVid() == null ? other.getVid() == null : this.getVid().equals(other.getVid()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
        result = prime * result + ((getVid() == null) ? 0 : getVid().hashCode());
        return result;
    }


}